//
//#ifndef _PROJECTZ_NUSER_NCOMMAND_NMATCHING_CN_MATCH_REQ_H_
//#define _PROJECTZ_NUSER_NCOMMAND_NMATCHING_CN_MATCH_REQ_H_
//
//#include "../../engine.h"
//
//#include "../../User.h"
//#include "../../Data.h"
//
//#include "../../NLogic/Static.h"
//
//namespace ProjectZ { namespace NCommand { namespace NMatching {
//
//class CN_MATCH_REQ
//{
//public:
//	static void OnExecute(User * pUser, ::Network::Packet * pPacket)
//	{
//		PREPARE_PACKET;
//
//		int GID = 0;
//		* pPacket >> GID;
//
//		NLogic::Space * pSpace = pUser->GetSpace();
//		if (NULL == pSpace)
//		{
//			::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
//			pAck->MsgCat("%c", -1);	// ACK가 아님
//			pAck->MakePacket(CMD_SC_MATCH_RES);
//
//			pUser->Send(pAck);
//			return;
//		}
//
//		User * pTarget = pSpace->FindUser(GID);
//		if (NULL == pTarget)
//		{
//			::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
//			pAck->MsgCat("%c", -1);	// ACK가 아님
//			pAck->MakePacket(CMD_SC_MATCH_RES);
//
//			pUser->Send(pAck);
//			return;
//		}
//
//		if (pTarget->GetUserSeq() == pUser->GetUserSeq())
//		{
//			::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
//			pAck->MsgCat("%c", -1);	// ACK가 아님
//			pAck->MakePacket(CMD_SC_MATCH_RES);
//
//			pUser->Send(pAck);
//			return;
//		}
//
//		// 정상적인 경우
//		::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
//		pAck->Write1(1);	// ACK가 아님
//		pAck->MakePacket(CMD_SC_MATCH_RES);
//		pUser->Send(pAck);
//
//
//		pUser->SetLocate(PL_PVP_FRIENDLY_WAIT);
//		pTarget->SetLocate(PL_PVP_FRIENDLY_WAIT);
//
//		pUser->player_info.FighterGID = GID;
//		pTarget->player_info.FighterGID = pUser->GetGID();
//
//		::Network::Packet * pNoti = ::Network::GETPACKETPOOL()->SEND_NEW();
//		pNoti->MsgCat("%d", pUser->GetGID());
//		pNoti->MakePacket(CMD_SN_MATCH_REQ);
//		pTarget->Send(pNoti);
//	}
//};
//
//} /*NMatching*/ } /*NCommand*/ } /*ProjdectZ*/
//
//
//
//#endif /* _CN_MATCH_REQ_H_ */
